function [profit,EYI,EYin,ProfitPart] = function_fQR2(Q, R)
	global I ci cI r EYI EYin CURRENT ProfitPart% 主程序中定义
	Q_new = Q;
	R_new = R;
	cols = size(Q, 2);
	for n=1:cols
		Q_new(:, n) = r * (n - 1) * Q_new(:, n);
		R_new(:, n) = (n - 1) * R_new(:, n);
    end
	EYI(1, CURRENT)=sum(R_new(I, :));
	EYin(1, CURRENT)=sum(sum(R_new))/CURRENT;
	R_new = ci * R_new;
	R_new(I, :) = cI / ci * R_new(I, :);
	ProfitPart(1, CURRENT)=sum(sum(Q_new));
	ProfitPart(2, CURRENT)=ci*EYin(1, CURRENT)*CURRENT;%这就是作者错的地方，实际上不能用前面的EYin，应该单独算前I-1行。为了复现我这与原文保持一致
	ProfitPart(3, CURRENT)=sum(R_new(I, :));
	profit = ProfitPart(1, CURRENT)-ProfitPart(2, CURRENT)-ProfitPart(3, CURRENT);     
	return;